package utilities.display.shapes.definedshapes;

import java.awt.Color;
import java.awt.Composite;
import java.awt.Polygon;
//import java.awt.Point;
//import java.awt.Rectangle;
import java.awt.Stroke;

import utilities.display.shapes.DrawShape;

/**
 * 
 * @author CoconutTank
 *
 */
public class DrawPolygon extends DrawShape
{
	/**
	 * 
	 */
	private static final long serialVersionUID = -5952001837262369165L;

	public DrawPolygon(int[] xPoints, int[] yPoints, int nPoints, Color lineColor, 
					   Stroke stroke, Composite lineComposite, 
					   Color fillColor, Composite fillComposite)
	{
		super(new Polygon(xPoints, yPoints, nPoints), lineColor, stroke, lineComposite, fillColor, fillComposite);
	}

	public DrawPolygon(Color lineColor, 
					   Stroke stroke, Composite lineComposite, 
					   Color fillColor, Composite fillComposite)
	{
		super(new Polygon(), lineColor, stroke, lineComposite, fillColor, fillComposite);
	}
	
	public void translate(int dx, int dy)
	{
		((Polygon)myShape).translate(dx, dy);
	}
	
	public int getX(int index)
	{
		if(index >= 0 && index < ((Polygon)myShape).npoints)
			return ((Polygon)myShape).xpoints[index];
		
		return 0;
	}
	
	public int getY(int index)
	{
		if(index >= 0 && index < ((Polygon)myShape).npoints)
			return ((Polygon)myShape).ypoints[index];
		
		return 0;
	}
	
	public int getPointCount() { return ((Polygon)myShape).npoints; }
	
	public void addPoint(int x, int y)
	{
		((Polygon)myShape).addPoint(x, y);
	}
}
